function showStealRobVehicleSearch() {
	window.location.href = "showStealRobVehicleSearch.do";
}

function ajaxFindStealRobVehicleSearchList(currentPage,pageSize) {
	$.ajax({
		type : "post",
		url : "ajaxStealRobVehicleSearchList.do",
		data : {
			plateNum:$("#plateNum").val(),	
			plateTypeId:$("#licencePlateKind").val(),		
			vehicleTypeId:$("#vehicleType").val(),
			usingCharacterId:$("#usingCharacterId").val(),
			vehicleClassificationId:$("#vehicleClassificationId").val(),
			currentPage:currentPage,
			pageSize:pageSize,
		},
		success : function(msg) {
			$("#listStealRobVehicleBox").html(msg);
		}
	});
}

function ajaxShowStealRobVehicleEdit(id){
	$.ajax({
		type:"post",
		url:"ajaxShowStealRobVehicleEdit.do",
		data:{stealRobVehicleId:id},
		success:function(msg){
			$("#dialog").html(msg);
			$("#dialog").dialog({
				autoOpen: true,
				width: 1200,
				title:$(".dialogtitle").attr("title"),
				modal: true,
				buttons: [
				          {
				        	  text: "保存",
				        	  click: function() {
				        		  ajaxSaveStealRobVehicle(this);
				        	  }
				          },
				          {
				        	  text: "关闭",
				        	  click: function() {
				        		  $(this).dialog( "close" );
				        	  }
				          }
				          ]
			});
		}
	});
}

function ajaxSaveStealRobVehicle(objDialog) {
	stealRobVehicleValidate();
	if ($("#frmStealRobVehicle").valid()) {
		$(objDialog).dialog("close");
		var options ={
				type: "post",
				url : "ajaxSaveStealRobVehicle.do",
				success: function (msg) {
					clearInput("#sltStealRobVehicle");
					ajaxFindStealRobVehicleSearchList();
					showMessageDialog("保存盗抢车","盗抢车信息保存成功。",null,dialogType.info);
				}
		};
		$("#frmStealRobVehicle").ajaxSubmit(options);
	}
}

function ajaxShowStealRobVehicleView(id){
	$.ajax({
		type:"post",
		url:"ajaxShowStealRobVehicleView.do",
		data:{stealRobVehicleId:id},
		success:function(msg){
			$("#dialog").html(msg);
			$("#dialog").dialog({
				autoOpen: true,
				width: 1200,
				title:$(".dialogtitle").attr("title"),
				modal: true,
				buttons : [ {
					text : "关闭",
					click : function() {
						$(this).dialog("close");
					}
				} ]
			});
		}
	});
}

function ajaxDeleteStealRobVehicleById(id) {
	var stealRobVehicleIds="";
	var sltSRV = $("#listStealRobVehicleList tbody input:checked").length;
	if(id==null){
		$("#listStealRobVehicleList tbody input:checked").each(function(){ 
			stealRobVehicleIds += $(this).val()+";";
		});
		if(sltSRV == 0){
			showMessageDialog("提示","请选择一行或多行",null,dialogType.info);
			return;
		}else{
			stealRobVehicleIds = stealRobVehicleIds.substring(0, stealRobVehicleIds.length-1);
		} 
	}else{
		stealRobVehicleIds=id;
		sltSRV = 1;
	}
	if( stealRobVehicleIds!=null){
		showMessageDialog("删除盗抢车","确定要删除所选“"+sltSRV+"”条盗抢车记录吗？",
				function () {
			$.ajax({     
				type:"post",
				url:"ajaxDeleteStealRobVehicleByIds.do",
				data:{stealRobVehicleIds:stealRobVehicleIds},
				success:function(msg){
					ajaxFindStealRobVehicleSearchList();
					showMessageDialog("提示","盗抢车辆删除成功",null,dialogType.info);
				}
			});
		}
		,dialogType.warning);
	}
}

function stealRobVehicleValidate(){
	$("#frmStealRobVehicle").validate({
		errorLabelContainer: $("#infoStealRobVehicle"),
		rules : {
			"plateNum" : {
				required :true				
			},
			"plateTypeId" : {
				required :true				
			}
		},
		messages : {
			"plateNum" : {
				required :"请输入号牌号码！"
			},
			"plateTypeId" : {
				required :"请输入号牌种类！"
			}
		},
		success: function(label) {
			label.html("&nbsp;");
		}
	});
}
